#!/usr/bin/perl

# Set of weird CRC32 calculation methods - used in ini/lst files.

#use Digest::Crc32;
use String::CRC32;
sub validate($)
{
#               my $crc = new Digest::Crc32();
#	       my $sum=$crc->filecrc32($_[0])  ^ -1;
#	       printf "%04X,%04X",$sum>>16,$sum&0xFFFF;
	       
	open S,'<'.$_[0];
	binmode S;
	my $sum=crc32(*S) ^ -1;
	close(S);
	sprintf "$_[0] %04X,%04X %i",$sum>>16,$sum&0xFFFF,$sum;
}

sub validate_ini($)
{
	open S,'<'.$_[0];
	binmode S;
	my $sum=crc32(*S,-1) ^ -1;
	close(S);
	sprintf "$_[0] %04X,%04X %u",$sum>>16,$sum&0xFFFF,$sum;
}

$\="\n";
print validate $_ foreach @ARGV;
